package com.hdf.etdemo.view.stepview;

import com.hdf.easytools.base.EasyToolsActivity;
import com.hdf.easytools.view.stepview.StepsView;
import com.hdf.etdemo.R;
import com.hdf.etdemo.R.drawable;
import com.hdf.etdemo.R.id;
import com.hdf.etdemo.R.layout;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public class StepViewActivity extends EasyToolsActivity {

	private StepsView stepsView;
    private final String[] labels = {"填表", "提交", "支付", "查看", "保存"};
	private int position=1;
    @Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.activity_step_view);
		/** 设置标题显示 */
		this.TitleVisib(0, 1, 1, 0, 0);
		/** 绑定标题点击事件 */
		this.TitleClick(0, 1, 0, 0, 0);
		/** 设置标题样式ʽ */
		this.TitleStyle(null, R.drawable.et_back, "选择器", null, 0);

		stepsView = (StepsView)this.findViewById(R.id.stepsView);
		stepsView.setLabels(labels)
        .setBarColorIndicator(0xFF888888)//设置未到达步骤的节点颜色
        .setProgressColorIndicator(0xFF05A9F4)//设置已到达步骤的节点颜色
        .setLabelColorIndicator(0xFF888888)//设置步骤label(文字描述)的字体颜色
        .setCompletedPosition(0)//设置已经到达了的节点位置，从0开始标识
        .drawView();//重新绘制控件，一般，节点状态发生变化时，调用此方法刷新控件
	}
    public void changeStep(View view){
    	stepsView.setCompletedPosition(position).drawView();
    	if(position<labels.length)
    		position++;
    	if(position==labels.length)
    		position=0;
    }
    @Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.left_img:
			finish();
			break;
		default:
			break;
		}
	}
}
